<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>刷新页面，实现自动累加</title>
</head>
<body>
    <div>
        <input type="text" id="screen" value="0">
        <button id="plus">累加</button>
    </div>
    <script>
        let plusBtn=document.querySelector('#plus');//捕捉plus
        plusBtn.onclick=function(){
            //1.获取到screen里面的值
            let screen=document.querySelector('#screen');
            let val=screen.value;
            //2.类型转换
            val=parseInt(val);
            console.log(val);
            //3.把value的值进行加1
            val=val+1;
            //4.把新值赋值回去
            screen.value=val;
        }
    </script>
</body>
</html>